<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>首页</title>
  <script type="text/javascript"  src="http://code.jquery.com/jquery-1.8.3.js"></script>
  <link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
  <script type="text/javascript"  src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
  <link rel="stylesheet" href="index.css">
  <link rel="stylesheet" href="main.css">
  <link rel="stylesheet" href="./swiper/dist/css/swiper.css">
  <script type="text/javascript" src="./static/store.legacy.min.js"></script>
  <script src="./static/util.js"></script>
</head>
<body>
  <div class="loginview">
    <div class="login">
      <span class="login_close">&#10005;</span>
      <p class="login_title">用户登录</p>
      <p class="input_p_login">
        <img src="./static/images/loginnameicon.png" alt="">
        <input type="text" placeholder="请输入账号" class="login_input" name="login_name">
      </p>
      <p class="input_p_login">
        <img src="./static/images/loginpassicon.png" alt="">
        <input type="password" placeholder="请输入密码" class="login_input" name="login_pass">
      </p>
      <p class="login_btn">登录</p>
      <p class="no_login">
          没有账号？
        <span class="no_login_sp">立即购买</span>
      </p>
    </div>
  </div>
  <header>
    <div class="headerSwipper">
      <div class="headerSwipper_div">
        <div class="headerSwipper_div_iconview">
          <img src="./static/images/logo.png" alt="">
        </div>
        <div class="headerSwipper_div_myicon">
          <!-- <img src="" alt=""> -->
          <span class="loginText">登录</span>
          <div class="headerSwipper_div_myicon_icon" style="display: none">
            <img src="./static/images/iconsmall.png" alt="">
          </div>
          <div class="headerSwipper_div_myicon_info">
            <ul>
              <li class="headerSwipper_div_myicon_info_li">消息</li>
              <li class="headerSwipper_div_myicon_info_li">退出</li>
            </ul>
          </div>
        </div>
        <ul class="headerSwipper_div_ul">
          <li class="headerSwipper_div_li mobileapp">手机APP</li>
          <li class="headerSwipper_div_li vipprop">开通VIP</li>
        </ul>
      </div>
    </div>
  </header>
  <section>
    <div class="ImgSwipperview">
      <!-- <img class="_img" src="./static/images/mainSwipper.png" alt=""> -->
      <div class="swiper-container">
        <div class="swiper-wrapper">
        </div>
        <!-- Add Arrows -->
        <div class="swiper-button-next"></div>
        <div class="swiper-button-prev"></div>
        <div class="swiper-pagination"></div>
        <div class="swiper-button-prev"></div>
        <div class="swiper-pagination"></div>
      </div>
    </div>
  </section>
  <section>
    <div class="mainContentView">
      <div class="contentView">
        <!-- 上侧导航 -->
        <div class="topnav">
          <ul class="contentView_ul">
            <li class="contentView_li contentView_li_active">首页</li>
            <li class="contentView_li">学习中心</li>
            <li class="contentView_li">志愿填报</li>
            <li class="contentView_li">微课</li>
            <li class="contentView_li">模拟试题</li>
            <li class="contentView_li">往届真题</li>
            <li class="contentView_li">咨询</li>
          </ul>
          <div class="inputview">
            <input class="inputview_input" id="tag" type="text" placeholder="搜索院校">
            <img  class="searchicon_img" src="./static/images/searchicon.png" alt="">
          </div>
        </div>
      </div>
    </div>
  </section>
  <section class="HomePage">
    <!-- 下方显示区域 -->
    <!-- 填报志愿 学习中心通道 -->
    <div class="mainContentView">
      <div class="contentView topdiatance">
          <div class="leftimgView volunteering">
            <img class="leftimgView_img" src="./static/images/mainleftimg.png" alt="">
            <div class="leftimgView_textview">
              <p class="leftimgView_textview_cn">填报志愿</p>
              <p class="leftimgView_textview_en">Fill in volunteering</p>
            </div>
          </div>
          <div class="leftimgView Learning">
            <img class="leftimgView_img" src="./static/images/mainrightimg.png" alt="">
            <div class="leftimgView_textview">
              <p class="leftimgView_textview_cn">学习中心</p>
              <p class="leftimgView_textview_en">Learning Center</p>
            </div>
          </div>
      </div>
      <!-- 超越1200的图标安排 -->
      <div class="iconItems">
        <div class="iconitem schools">
          <div class="iconview">
            <img class="iconview_img" src="./static/images/icon01.png" alt="">
          </div>
          <p class="iconitem_p">院校大全</p>
        </div>
        <div class="iconitem major">
          <div class="iconview">
            <img class="iconview_img" src="./static/images/icon02.png" alt="">
          </div>
          <p class="iconitem_p">专业大全</p>
        </div>
        <div class="iconitem mentality">
          <div class="iconview">
            <img class="iconview_img" src="./static/images/icon03.png" alt="">
          </div>
          <p class="iconitem_p">心理辅导</p>
        </div>
        <div class="iconitem careerPlanning">
          <div class="iconview">
            <img class="iconview_img" src="./static/images/icon04.png" alt="">
          </div>
          <p class="iconitem_p">职业规划</p>
        </div>
        <div class="iconitem infotest">
            <div class="iconview">
              <img class="iconview_img" src="./static/images/icon05.png" alt="">
            </div>
            <p class="iconitem_p">高考资讯</p>
          </div>
          <div class="iconitem recruitmentProp">
            <div class="iconview">
              <img class="iconview_img" src="./static/images/icon06.png" alt="">
            </div>
            <p class="iconitem_p">自主招生</p>
          </div>
          <div class="iconitem onlyjoin">
            <div class="iconview">
              <img class="iconview_img" src="./static/images/icon07.png" alt="">
            </div>
            <p class="iconitem_p">单独招生</p>
          </div>
      </div>
    </div>

  </section>
  <!-- 学习中心 -->
  <section class="learnCenterPage">
    <div class="learncenterview">
      <div class="learncenter">
        <div class="maincontentSwipper">
          <!-- 微课 -->
          <p class="segmentation moreSmallClass">
            <span class="segmentation_title">微课</span>
            <span class="segmentation_more">更多>></span>
          </p>
          <div class="Smallclass mainSmallclass">
           <!-- 学习中心微课动态显示区域 -->
          </div>
          <!-- 模拟试题 -->
          <p class="segmentation clearBoth moremockTest">
            <span class="segmentation_title">模拟试题</span>
            <span class="segmentation_more">更多>></span>
          </p>
          <div class="questionView mainquetionView">
            <ul class="questionView_ul questionView_ul_flex mainquetionView_ul">
             <!-- 模拟试题动态显示区域 -->
            </ul>
          </div>
  
          <!-- 往届真题 -->
          <p class="segmentation clearBoth previousQuestions">
            <span class="segmentation_title">往届真题</span>
            <span class="segmentation_more">更多>></span>
          </p>
          <div class="questionView mainpreviousQuestions">
            <ul class="questionView_ul questionView_ul_flex mainpreviousQuestions_ul">
              <!-- 往届试题动态添加区域 -->
            </ul>
          </div>
        </div>
        <!-- 微课更多页面 -->
        <div class="Smallclass topThree">
        </div>
        <!-- 模拟试题更多页面 -->
        <div class="questionView questionView_more">
          <!-- <ul class="subjectNav">
            <li class="subjectNav_li">语文</li>
          </ul> -->
          <ul class="questionView_ul questionView_ul_flex questionView_ul_more">
          </ul>
        </div>
        <!-- 自主招生页面 -->
        <div class="questionView recruitment_more" style="display: none">
          <!-- <ul class="subjectNav">
            <li class="subjectNav_li">语文</li>
          </ul> -->
          <ul class="questionView_ul recruitment_ul_more">
            
          </ul>
        </div>
        <!-- 咨询页面 -->
        <div class="questionItems consultView">
          <div class="markedBtnview">
            <div class="markedBtnview_left consultOnline">
              <img src="./static/images/note.png" alt="">
              <span>在线咨询</span>
            </div>
            <div class="markedBtnview_left diffbackcolor">
              <img src="./static/images/consult.png" alt="">
              <span>我要提问</span>
            </div>
          </div>
          <p class="questionItems_topnav"><span class="questionItems_topnav_span questionItems_topnav_span_active clearborderRight">最新</span><span class="questionItems_topnav_span">未解决</span></p>
          <!-- 问题回答区域 -->
          <div class="questionView consultView_div">
            <ul class="questionView_ul consultView_ul questionView_ul_border">

            </ul>
          </div>
        </div>
        <!-- 分页 来自index.html -->
        <p class="pagingView">
          <span class="pagebtn firstpage">首页</span>
          <span class="pagebtn frontpage">前一页</span>
          <span class="pagesview">
            <!-- 动态添加页码 -->
          </span>
          <span class="pagebtn backpage">后一页</span>
          <span class="pagebtn lastpage">尾页</span>
        </p>
      </div>
    </div>
  </section>


  <footer>
    <div class="footerSwipper">
      <div class="footerSwipper_div">
        <ul class="footerSwipper_div_ul">
          <span class="footerSwipper_div_ul_span"><a href="./index.html">首页</a></span>
          <li class="footerSwipper_div_ul_li"><a href="./schools.html?keyword=">院校大全</a></li>
          <li class="footerSwipper_div_ul_li"><a href="./major.html">专业大全</a></li>
          <li class="footerSwipper_div_ul_li"><a href="./mentality.html">心理辅导</a></li>
          <li class="footerSwipper_div_ul_li"><a href="./careerPlanning.html">职业规划</a></li>
          <li class="footerSwipper_div_ul_li"><a href="./infoTest.html">高考资讯</a></li>
          <li class="footerSwipper_div_ul_li"><a href="./recruitment.html?type=1">自主招生</a></li>
          <li class="footerSwipper_div_ul_li"><a href="./recruitment.html?type=2">单独招生</a></li>
        </ul>
        <ul class="footerSwipper_div_ul">
          <span class="footerSwipper_div_ul_span">学习提升</span>
          <li class="footerSwipper_div_ul_li"><a href="./index.html?index=3">微课</a></li>
          <li class="footerSwipper_div_ul_li"><a href="./index.html?index=4">模拟试题</a></li>
          <li class="footerSwipper_div_ul_li"><a href="./index.html?index=5">往届试题</a></li>
        </ul>
        <ul class="footerSwipper_div_ul">
          <span class="footerSwipper_div_ul_span">志愿填报</span>
          <li class="footerSwipper_div_ul_li zixuntz"><a>咨询</a></li>
          <li class="footerSwipper_div_ul_li"><a href="./mobileapp.html">下载APP</a></li>
        </ul>
        <!-- 扫一扫关注我们区域 -->
        <div class="QRcodeSwipper">
          <span class="QRcodeSwipper_span">扫一扫关注我们</span>
          <div class="QRcodeSwipper_imgview">
            <img src="./static/images/qr.png" alt="">
          </div>
        </div>
        <!-- 中间信息区域 -->
        <div class="middleInfo">
          <span class="middleInfo_span_city">中国·河南·郑州</span>
          <span class="middleInfo_span_GE"><span class="middleInfo_span_GE_icon middleInfo_span_GE_icon_special phone_icon"><img src="./static/images/phone.png" alt=""></span><span class="middleInfo_span_GE_text middleInfo_span_GE_text_color">0371-68064945</span></span>
          <span class="middleInfo_span_GE"><span class="middleInfo_span_GE_icon message_icon"><img src="./static/images/message.png" alt=""></span><span class="middleInfo_span_GE_text">595879735@qq.com</span></span>
          <span class="middleInfo_span_GE"><span class="middleInfo_span_GE_icon message_icon"><img src="./static/images/store.png" alt=""></span><span class="middleInfo_span_GE_text">河南柒佰伴教育信息咨询有限公司
          </span></span>
          <span class="middleInfo_span_GE"><span class="middleInfo_span_GE_icon middleInfo_span_GE_icon_special address_icon"><img src="./static/images/address.png" alt=""></span><span class="middleInfo_span_GE_text middleInfo_span_GE_text_special">郑州市郑东新区立体世界
            </span></span>
        </div>
        <p class="footerSwipper_div_p">河南世霖网络软件科技 2014-2018 豫ICP备14010456号-1</p>
      </div>
    </div>
  </footer>
  <script src="./static/util.js"></script>
  <script src="./swiper/dist/js/swiper.js"></script>
  <script>
    var swiper = new Swiper('.swiper-container', {
      navigation: {
        nextEl: '.swiper-button-next',
        prevEl: '.swiper-button-prev',
      },
      pagination: {
        el: '.swiper-pagination',
      },
      pagination: {
        el: '.swiper-pagination',
      },
      observer:true,//修改swiper自己或子元素时，自动初始化swiper
      observeParents:true//修改swiper的父元素时，自动初始化swiper
    });
  </script>
  <script>
    $(document).ready(function(){

      // 页码初始化
      var currentpage = 1
      var pagestotal = 1
      // 动态请求的接口
      var possibleUrl = ''
      var testQuestion = {
        stu_nav: 2,
        stu_type: 1,
        page: 1
      }
      var type = 0
      var currentRender = 1
      // .learncenter 导入导航标签方法
      // ArrowNavigation($('.learncenter'),["main","smallClass"])
      // 登录隐藏
      $('.headerSwipper_div_myicon_info').hide()
      // 记录li标签是否被点过 避免重复进行ajax 在点击一次加1 0> 10< 绕过ajax请求
      var liajaxUse = [0,0,0,0,0,0,0]
      // 渲染icon区域的图标
      // console.log($('.iconItems').find('.iconitem'))
      // for(item in $('.iconItems').find('.iconitem')) {
      //   $('.iconItems').find('.iconitem').eq(item).find('img').attr('src','./static/images/icon0' + (Number(item)+1) + '.png')
      // }
      // 鼠标移入移除事件
      $('.iconItems').on('mouseleave mouseover','.iconitem',function(event) {
        // 监听是第几个 转换图标
        var index = $(this).index()
        if(event.type == 'mouseover') {
          console.log('进去')
          $(this).find('.iconview').css({
            'background-color': 'rgba(46,196,97,1)'
          })
          // console.log($(this).find('.iconview_img'))
          $(this).find('.iconview_img').attr('src', './static/images/icon0' + (Number(index)+1) + '_a.png')
        }
        if(event.type == 'mouseleave') {
          console.log('离开')
          console.log($(this))
          $(this).find('.iconview').css({
            'background-color': '#fff'
          })
          $(this).find('.iconview_img').attr('src', './static/images/icon0' + (Number(index)+1) + '.png')
        }
      })
      // 监听li选择事件
      $('.contentView_ul').on('click', '.contentView_li', function() {
        // if($(this).hasClass('contentView_li_active')) {
        //   return
        // }
        clickchange($(this),'.contentView_li','contentView_li_active')
        $('.learncenter').find('.subjectNav').remove()
        $('.recruitment_ul_more').empty()
        $('.recruitment_more').hide()
        removeArrowNavigation()
        if($(this).index() == 0) {
          $('.HomePage').show()
          $('.maincontentSwipper').hide()
          $('.learnCenterPage').hide()
          $('.topThree').hide()
          $('.questionView_more').hide()
          $('.consultView').hide()
        }
        if($(this).index() == 1) {
          loadingShow()
          $.ajax({
            url: urlhost + '/admin.php/api/homepage/study_lst',
            type: 'POST',
            data: {},
            header: {},
            success: function (res) {
              if (res.code == 0) {
                loadingHide()
                var centerData = res
                // 动态添加学习中心内容
                rendering($('.mainSmallclass'), 0, centerData.data.wk)
                rendering($('.mainquetionView_ul'), 1, centerData.data.mnst)
                rendering($('.mainpreviousQuestions_ul'), 1, centerData.data.wjzt)
              } else {
                // 移除加载中样式
                loadingHide()
                return(res.data)
              }
            },
            fail: function () {
              alert('网络有问题')
            }
          })
          $('.HomePage').hide()
          $('.maincontentSwipper').show()
          $('.learnCenterPage').show()
          $('.topThree').hide()
          $('.questionView_more').hide()
          $('.consultView').hide()
          changeInitPage(1, 1)
        }
        if($(this).index() == 2) {
          if(!store.get('uid')) {
            $('.loginview').show()
            return
          }
          window.location.href = './volunteer.html'
        }
        // 微课更多
        if($(this).index() == 3) {
          loadingShow()
          $.ajax({
            url: urlhost + '/admin.php/api/homepage/wk_list',
            type: 'POST',
            data: {type: 1, page: 1},
            header: {},
            success: function (res) {
              if (res.code == 0) {
                loadingHide()
                var wkmain_list = res
                // 动态添加学习中心内容
                rendering ($('.topThree'), 0, wkmain_list.data)
                changeInitPage(wkmain_list.list_page, 1)
                possibleUrl = '/admin.php/api/homepage/wk_list'
                testQuestion = {}
                testQuestion.type = 1
                testQuestion.page = 1
                currentRender = 0
              } else {
                // 移除加载中样式
                loadingHide()
                return(res.data)
              }
            },
            fail: function () {
              alert('网络有问题')
            }
          })
          subjectApply($('.learncenter'), ['语文','数学','英语','历史', '政治','地理','物理','化学'])
          $('.HomePage').hide()
          $('.maincontentSwipper').hide()
          $('.learnCenterPage').show()
          $('.topThree').show()
          $('.questionView_more').hide()
          $('.consultView').hide()
          // ArrowNavigation($('.learncenter'),["main","smallClass"])
        }
        // 试题更多
        if($(this).index() == 4) {
          subjectApply($('.questionView_more'), ['语文','文科数学','理科数学','英语', '文综','理综'])
          loadingShow()
          $.ajax({
            url: urlhost + '/admin.php/api/homepage/st_list',
            type: 'POST',
            data: {stu_nav: 2, stu_type: 1, page: 1},
            header: {},
            success: function (res) {
              if (res.code == 0) {
                loadingHide()
                var mnmain_list = res
                rendering ($('.questionView_ul_more'), 1, mnmain_list.data)
                possibleUrl = '/admin.php/api/homepage/st_list'
                testQuestion = {}
                testQuestion.stu_nav = 2
                testQuestion.stu_type = 1
                testQuestion.page = 1
                changeInitPage(mnmain_list.last_page, 1)
                currentRender = 1
              } else {
                // 移除加载中样式
                loadingHide()
                return(res.data)
              }
            },
            fail: function () {
              alert('网络有问题')
            }
          })
          $('.HomePage').hide()
          $('.maincontentSwipper').hide()
          $('.learnCenterPage').show()
          $('.topThree').hide()
          $('.questionView_more').show()
          $('.consultView').hide()
        }
        // 试题更多
        if($(this).index() == 5) {
          subjectApply($('.questionView_more'), ['语文','文科数学','理科数学','英语', '文综','理综'])
          loadingShow()
          $.ajax({
            url: urlhost + '/admin.php/api/homepage/st_list',
            type: 'POST',
            data: {stu_nav: 3, stu_type: 1, page: 1},
            header: {},
            success: function (res) {
              if (res.code == 0) {
                loadingHide()
                var wjmain_list = res
                rendering ($('.questionView_ul_more'), 1, wjmain_list.data)
                possibleUrl = '/admin.php/api/homepage/st_list'
                testQuestion = {}
                testQuestion.stu_nav = 3
                testQuestion.stu_type = 1
                testQuestion.page = 1
                changeInitPage(wjmain_list.last_page, 1)
                currentRender = 1
              } else {
                // 移除加载中样式
                loadingHide()
                return(res.data)
              }
            },
            fail: function () {
              alert('网络有问题')
            }
          })
          $('.HomePage').hide()
          $('.maincontentSwipper').hide()
          $('.learnCenterPage').show()
          $('.topThree').hide()
          $('.questionView_more').show()
          $('.consultView').hide()
          
        }
        // 咨询页面
        if($(this).index() == 6) {
          if(!store.get('uid')) {
            $('.loginview').show()
            return
          }
          $('.HomePage').hide()
          $('.maincontentSwipper').hide()
          $('.learnCenterPage').show()
          $('.topThree').hide()
          $('.questionView_more').hide()
          $('.consultView').show()
          testQuestion = {}
          testQuestion.status = 1
          testQuestion.page = 1
          testQuestion.uid = store.get('uid')
          possibleUrl = '/admin.php/api/homepage/issue_list'
          loadingShow()
          $.ajax({
            url: urlhost + possibleUrl,
            type: 'POST',
            data: testQuestion,
            header: {},
            success: function (res) {
              if (res.code == 0) {
                loadingHide()
                var question_serverdata = res
                rendering ($('.consultView_ul'), 4, question_serverdata.data)
                changeInitPage(question_serverdata.list_page, 1)
                currentRender = 1
              } else {
                // 移除加载中样式
                loadingHide()
                return(res.data)
              }
            },
            fail: function () {
              alert('网络有问题')
            }
          })
        }
      })
      // 页码专属ajax
      function pageAjax(possibleUrl, testQuestion) {
        loadingShow()
        $.ajax({
          url: urlhost + possibleUrl,
          type: 'POST',
          data: testQuestion,
          header: {},
          success: function (res) {
            if (res.code == 0) {
              loadingHide()
              dataNow = res
              var domlist = [$('.topThree'), $('.questionView_ul_more')]
              rendering(domlist[currentRender], currentRender, dataNow.data)
            } else {
              // 移除加载中样式
              loadingHide()
              return(res.data)
            }
          },
          fail: function () {
            alert('网络有问题')
          }
        })
      }


      // 全局页码初始化改变方法
      function changeInitPage (a, b) {
        currentpage = b
        currentRender = b
        pagestotal = a
        pagefuc(pagestotal, currentRender)
      }
      // 页码方法
      function pagefuc (pagestotal, currentpage){
        // 页面初始化方法
        function init(pagestotal, currentpage) {
          if(pagestotal <= 5) {
            var html = ''
            $('.pagesview').html('')
            for(var i=1; i <= pagestotal; i++) {
              if(i == currentpage) {
                html += '<span class="pageitem pageactive" id="' + i + '">' + i + '</span>'
              }else {
                html += '<span class="pageitem" id="' + i + '">' + i + '</span>'
              }
            }
            $('.pagesview').html(html)
          }else {
            var html = ''
            $('.pagesview').html('')
            var length = (Math.floor(currentpage/5)+1)*5 >= pagestotal?pagestotal:Math.floor(currentpage/5)*5+5
            for(var i=(Math.floor((currentpage-1)/5)+1)*5-4; i <= length; i++) {
              if(i == currentpage) {
                html += '<span class="pageitem pageactive" id="' + i + '">' + i + '</span>'
              }else {
                html += '<span class="pageitem" id="' + i + '">' + i + '</span>'
              }
            }
            $('.pagesview').html(html)
          }
        }
        init(pagestotal, currentpage)
        }
        pagefuc(pagestotal, currentpage)
         // 点击页码事件 页码变色 进行获取数据
      $('.pagingView').on('click', '.pageitem', function() {
        if($(this).hasClass('pageactive')) {
          return
        }
        $(this).parent().find('.pageitem').removeClass('pageactive')
        $(this).addClass('pageactive')
        currentpage = Number($(this).text())
        testQuestion.page = currentpage
        pageAjax(possibleUrl, testQuestion)
      })
      // 前一页事件
      $('.frontpage').click(
       function() {
          if(currentpage === 1) {
            return
          }
          if($('.pageactive').index() === 0) {
            $('#'+(currentpage+4)).remove()
            currentpage--
            $(this).parent().find('.pageitem').removeClass('pageactive')
            $('.pagesview').prepend('<span class="pageitem pageactive" id="' + currentpage + '">' + currentpage + '</span>')
            testQuestion.page = currentpage
            pageAjax(possibleUrl, testQuestion)
            return
          }
          currentpage--
          $(this).parent().find('.pageitem').removeClass('pageactive')
          $('#'+currentpage).addClass('pageactive')
          testQuestion.page = currentpage
          var dataNow =  ''
          pageAjax(possibleUrl, testQuestion)
        }
      )
      // 后一页事件
      $('.backpage').click(
         function() {
          // console.log(currentpage)
          if(currentpage === pagestotal) {
            return
          }
          if($('.pageactive').index() === 4) {
            $('#'+(currentpage-4)).remove()
            currentpage++
            $(this).parent().find('.pageitem').removeClass('pageactive')
            $('.pagesview').append('<span class="pageitem pageactive" id="' + currentpage + '">' + currentpage + '</span>')
            testQuestion.page = currentpage
            pageAjax(possibleUrl, testQuestion)
            return
          }
          currentpage++
          $(this).parent().find('.pageitem').removeClass('pageactive')
          $('#'+currentpage).addClass('pageactive')
          testQuestion.page = currentpage
          var dataNow =  ''
          pageAjax(possibleUrl, testQuestion)
        }
      )
      // 首页事件
      $('.firstpage').click(
         function() {
          currentpage = 1
          testQuestion.page = currentpage
          var dataNow =  ''
          pageAjax(possibleUrl, testQuestion)
          pagefuc(pagestotal, currentpage)
        }
      )
      // 末尾页点击事件
      $('.lastpage').click(
         function() {
          loadingShow()
          currentpage = pagestotal
          testQuestion.page = currentpage
          pageAjax(possibleUrl, testQuestion)
          pagefuc(pagestotal, currentpage)
        }
      )

      // 点击更多 微课
      $('.learnCenterPage').on('click','.moreSmallClass', function() {
        var wkmore =  ''
        $.ajax({
            url: urlhost + '/admin.php/api/homepage/wk_list',
            type: 'POST',
            data: {type: 1, page: 1},
            header: {},
            success: function (res) {
              if (res.code == 0) {
                loadingHide()
                wkmore = res
                rendering ($('.topThree'), 0, wkmore.data)
                changeInitPage(wkmore.list_page, 1)
                possibleUrl = '/admin.php/api/homepage/wk_list'
                testQuestion = {}
                testQuestion.type = 1
                testQuestion.page = 1
                currentRender = 0
              } else {
                // 移除加载中样式
                loadingHide()
                return(res.data)
              }
            },
            fail: function () {
              alert('网络有问题')
            }
          })
        removeArrowNavigation ()
        $('.HomePage').hide()
        $('.maincontentSwipper').hide()
        $('.learnCenterPage').show()
        $('.topThree').show()
        $('.questionView_more').hide()
        ArrowNavigation($('.learncenter'),["main","smallClass"])
      })
      // 点击模拟真题更多 moremockTest
      $('.learnCenterPage').on('click','.moremockTest', function() {
        $.ajax({
          url: urlhost + '/admin.php/api/homepage/st_list',
          type: 'POST',
          data: {stu_nav: 2, stu_type: 1, page: 1},
          header: {},
          success: function (res) {
            if (res.code == 0) {
              loadingHide()
              var mnmain_list = res
              rendering ($('.questionView_ul_more'), 1, mnmain_list.data)
              possibleUrl = '/admin.php/api/homepage/st_list'
              testQuestion = {}
              testQuestion.stu_nav = 2
              testQuestion.stu_type = 1
              testQuestion.page = 1
              changeInitPage(mnmain_list.last_page, 1)
              currentRender = 1
            } else {
              // 移除加载中样式
              loadingHide()
              return(res.data)
            }
          },
          fail: function () {
            alert('网络有问题')
          }
        })
        removeArrowNavigation ()
        $('.HomePage').hide()
        $('.maincontentSwipper').hide()
        $('.learnCenterPage').show()
        $('.topThree').hide()
        $('.questionView_more').show()
        ArrowNavigation($('.learncenter'),["main","mockTest"])

      })
      // 往届真题 和 模拟真题的样式相同 数据不同 previousQuestions
      $('.learnCenterPage').on('click','.previousQuestions', function() {
        var wjmain_list =  ''
        $.ajax({
          url: urlhost + '/admin.php/api/homepage/st_list',
          type: 'POST',
          data: {stu_nav: 3, stu_type: 1, page: 1},
          header: {},
          success: function (res) {
            if (res.code == 0) {
              loadingHide()
              wjmain_list = res
              rendering ($('.questionView_ul_more'), 1, wjmain_list.data)
              possibleUrl = '/admin.php/api/homepage/st_list'
              testQuestion = {}
              testQuestion.stu_nav = 3
              testQuestion.stu_type = 1
              testQuestion.page = 1
              changeInitPage(wjmain_list.last_page, 1)
              currentRender = 1
            } else {
              // 移除加载中样式
              loadingHide()
              return(res.data)
            }
          },
          fail: function () {
            alert('网络有问题')
          }
        })
        $('.HomePage').hide()
        $('.maincontentSwipper').hide()
        $('.learnCenterPage').show()
        $('.topThree').hide()
        $('.questionView_more').show()
        ArrowNavigation($('.learncenter'),["main","previousQuestions"])
      })
      // 渲染子页面数据
      function rendering (item, type, data) {
        var applyhtml = ''
        item.html('')
         // data获取的数据
         if(type == 0) {
          for(var i = 0; i < data.length; i++) {
            applyhtml += '<div class="classitem" id="Curriculum' + data[i].id + '">'
             + '<video src="' + data[i].stu_video + '" class="classitem_vidio" controls></video>'
             + '<img class="mainimg" src="' + data[i].stu_pic + '">'
            + '<img class="palyer" src="./static/images/player.png">'
             + '<p class="classitem_p">' + data[i].stu_title + '</p>'
           + '</div>'
          }
          item.html(applyhtml)
          return
        }
        if(type == 1) {
          for(var i = 0; i < data.length; i++) {
            applyhtml += '<li class="testQuestion" id="test' + data[i].id + '">'
               + '<span class="leftimgview"><img class="leftimgview_img" src="' + data[i].stu_pic + '" alt=""><span class="leftimgview_text">模拟</span></span>'
               + '<div class="infotextview">'
                 + '<span class="infotextview_title">' + data[i].stu_title + '</span>'
                 + '<span class="infotextview_time">' + data[i].add_time + '</span>'
                 + '</div>'
             + '</li>'
          }
          item.html(applyhtml)
          return
        }
        if(type == 8) {
          for(var i = 0; i < data.length; i++) {
            applyhtml += '<li class="collectNewsview" id="careerPlanning' + data[i].id + '">'
             + '<span class="collectNewsview_imgview"><img class="collectNewsview_imgview_img" src="' + data[i].pics + '" alt=""></span>'
             + '<div class="NewsTextview">'
               + '<span class="NewsTextview_title">' + data[i].title + '</span>'
               + '<span class="NewsTextview_text">' + data[i].desc + '</span>'
               + '<span class="NewsTextview_time">2018-11-24</span>'
             + '</div>'
            +  '<div class="newsitemview">'
               + '<span class="newsitemview_span">查看详情</span>'
             + '</div>'
             + '</li>'
          }
          item.html(applyhtml)
          return
        }
        if(type == 4) {
          var srclist = ['./static/images/noyover.png', './static/images/over.png']
          var collect_img = ['./static/images/collect_not.png','./static/images/collect.png']
          for(var i = 0; i < data.length; i++) {
                applyhtml += '<li class="questionView_ul_li" id="consultView' + data[i].id + '">'
              + '<div class="quiconview"><img class="quiconview_img" src="' + srclist[data[i].status] + '" alt=""></div>'
              + '<div class="textview">'
                + '<span class="textview_title">' + data[i].desc + '</span>'
                + '<span class="textview_time">' + data[i].add_time + '</span>'
                + '<span class="textview_answer"></span>'
                + '</div>'
                + '<div class="starcollectview">'
                  + '<img class="starcollectview_img" img-star="'+ data[i].status +'" src="'+ collect_img[data[i].status] +'" alt="">'
                + '</div>'
            + '</li>'

            // $.post('http://jy.sanzhima.cn/admin.php/api/homepage/issue_detail',{
            //   uid: store.get('uid'),
            //   detail_id: data[i].id
            // },function (answer) {
            //   console.log(answer.data.reply)
            //   applyhtml +=  '<span class="textview_answer">'+ answer.data.reply +'</span>'
            // })
          }
          for(var i = 0; i < data.length; i++) {
            let id = data[i].id
            $.post('http://jy.sanzhima.cn/admin.php/api/homepage/issue_detail',{
              uid: store.get('uid'),
              detail_id: data[i].id
            },function (answer) {
              console.log(id)
              // $('#consultView'+data[i].id)
              $('#consultView'+id).find('.textview_answer').text(answer.data.reply)
              // console.log(answer.data.reply)
              // applyhtml +=  '<span class="textview_answer">'+ answer.data.reply +'</span>'
            })
          }
          item.html(applyhtml)
          return
        }
        if(type == 3) {
          for(var i = 0; i < data.length; i++) {
            var spanhtml = ''
            spanhtml += '<span class="universitytext_lable_span">' + data[i].rank + '</span>'
            for(list in data[i]) {
              if(list.slice(0, 5) == 'label') {
                if(data[i][list]) {
                  spanhtml += '<span class="universitytext_lable_span">' + data[i][list] + '</span>'
                }
              }
            }
            var nowhtml = '<li class="universityView" id="school' + data[i].id + '">'
             + '<span class="universityImgview"><img class="universityImgview_img" src="' + data[i].pic + '" alt=""></span>'
             + '<div class="universitytext">'
               + '<span class="universitytext_title">' + data[i].sch_name + '</span>'
               + '<p class="universitytext_lable">' + spanhtml + '</p>'
             + '</div>'
             + '<div class="addWish_shool">'
               + '<span class="addWishImgview_school"><img src="./static/images/GoItem.png" alt=""></span>'
             + '</div>'
           + '</li>'
            applyhtml += nowhtml
          }
          item.html(applyhtml)
          return
        }
      }
      // 试题上方科目选择列表 方法
      // <ul class="subjectNav">
      //       <li class="subjectNav_li">语文</li>
      //     </ul>
      function subjectApply (item, subjects) {
        item.find('.subjectNav').remove()
        var subject = ''
        for(var i=0; i < subjects.length; i++) {
          if(i == 0) {
            subject += '<li class="subjectNav_li subjectNav_li_active" id="sub' + i + '">' + subjects[i] + '</li>'
          }else {
            subject += '<li class="subjectNav_li" id="sub' + i + '">' + subjects[i] + '</li>'
          }
        }
        subject = '<ul class="subjectNav">' + subject + '</ul>'
        item.prepend(subject)
      }
      // 监听科目选择改变事件
      $('.learncenter').on('click', '.subjectNav_li',  function (){
        clickchange($(this), '.subjectNav_li', 'subjectNav_li_active')
        var indexType = Number($(this).index()) + 1
        var sub_list = [1,2,6,3,4,5]
        if(testQuestion.stu_nav == 3 || testQuestion.stu_nav == 2) {
          indexType = sub_list[$(this).index()]
        }
        testQuestion.page = 1
        if(!testQuestion.stu_nav) {
          testQuestion.type = indexType
        }else {
          testQuestion.stu_type = indexType
        }
        var dataNow =  ''
        $.ajax({
          url: urlhost + possibleUrl,
          type: 'POST',
          data: testQuestion,
          header: {},
          success: function (res) {
            if (res.code == 0) {
              loadingHide()
              dataNow = res
              var domlist = [$('.topThree'), $('.questionView_ul_more')]
              rendering(domlist[currentRender], currentRender, dataNow.data)
              changeInitPage(dataNow.last_page, 1)
            } else {
              // 移除加载中样式
              widowAle(res.msg)
              loadingHide()
              dataNow = res
              var domlist = [$('.topThree'), $('.questionView_ul_more')]
              rendering(domlist[currentRender], currentRender, dataNow.data)
              changeInitPage(dataNow.last_page, 1)
              return(res.data)
            }
          },
          fail: function () {
            alert('网络有问题')
          }
        })

      })
      // 监听问题收藏事件
      $('.questionItems').on('click', '.starcollectview', function () {
        var img_star = $(this).find('img').attr('img-star')
        var img_id = $(this).parents('li').attr('id').slice(11)
        if(img_star == '1') {
          $(this).find('img').attr('src', './static/images/collect_not.png')
          $(this).find('img').attr('img-star', '0')
          $.ajax({
            url: urlhost + '/admin.php/api/homepage/issue_sc',
            method: 'POST',
            data: {
              uid: store.get('uid'),
              flag: 2,
              issue_id: img_id
            },
            success: function (res) {
              widowAle(res.msg)
            }
          })
        }else {
          $(this).find('img').attr('src', './static/images/collect.png')
          $(this).find('img').attr('img-star', '1')
          $.ajax({
            url: urlhost + '/admin.php/api/homepage/issue_sc',
            method: 'POST',
            data: {
              uid: store.get('uid'),
              flag: 1,
              issue_id: img_id
            },
            success: function (res) {
              widowAle(res.msg)
            }
          })
        }
      })
      // 监听自主招生选择改变事件
      $('.recruitment_more').on('click', '.subjectNav_li', function (){
        clickchange($(this), '.subjectNav_li', 'subjectNav_li_active')
        // ajax获取值 重新redering
        rendering ($('.recruitment_ul_more'), 1, 10)
      })
      // 监听查看详情事件
      $('.learncenterview').on('click', '.newsitemview', function() {
        var itemid = $(this).parents('li').attr('id')
        window.location.href = './item.html?id=' + itemid
      })
      // 监听学校列表点击事件
      $('.learncenterview').on('click', '.universityView', function() {
        var itemid = $(this).parents('li').attr('id')
        window.location.href = './shoolitem.html?id=' + itemid + '&type=3'
      })
      // 下方图标点击事件
      // 自主招生点击事件
      $('.recruitmentProp').click(
        function () {
          window.location.href = './recruitment.html?type=1'
        }
      )
      // 单独招生点击事件
      $('.onlyjoin').click(
        function () {
          window.location.href = './recruitment.html?type=2'
        }
      )
      // 职业规划点击事件
      $('.careerPlanning').click(
        function () {
          window.location.href = './careerPlanning.html'
        }
      )
      // 专业大全点击事件
      $('.major').click(
        function () {
          // if(!store.get('uid')) {
          //   $('.loginview').show()
          //   return
          // }
          window.location.href = './major.html'
        }
      )
      // 院校大全点击事件
      $('.schools').click(
        function () {
          // if(!store.get('uid')) {
          //   $('.loginview').show()
          //   return
          // }
          window.location.href = './schools.html?keyword='
        }
      )
      // 高考资讯点击事件
      $('.infotest').click(
        function () {
          window.location.href = './infoTest.html'
        }
      )
      $('.mentality').click(
        function () {
          window.location.href = './mentality.html'
        }
      )
      // 页面首页初始化
       function pageinit (index) {
        // console.log($('.contentView_li').eq(index))
        $('.contentView_ul').find('.contentView_li').eq(index).click()
        $('.loginview').hide()
        // var datadata =  packagingAjax('/admin.php/api/homepage/sysj',{})
      }
      var index = Number(getparse(location.href,0)) || 0
      // console.log(index)
      pageinit(index)
      // 遮罩层显示隐藏事件
      $('body').on('click', '.closeQu', function() {
        $(this).parents('.OnlineQuestion').remove()
      })
      $('body').on('click', '.OnlineQuestion', function(e) {
        if(e.target.className == 'OnlineQuestion'){
          $(this).remove()
        }
      })
      $('.learnCenterPage').on('click', '.diffbackcolor', function () {
        $('body').prepend('  <div class="OnlineQuestion">\n        <div class="questionTextView margin_left">\n          <p class="questionTextView_title">\u5728\u7EBF\u63D0\u95EE</p>\n          <textarea name="questionTextView_put" id="questionTextView_put" cols="30" rows="10"></textarea>\n          <p class="submit zixun_btn">\u63D0\u4EA4</p>\n          <img class="closeQu" src="./static/images/close.png" alt="">\n        </div>\n      </div>');
      });
      // 监听palyer点击事件
      $('.learncenter').on('click', '.palyer', function() {
        // alert('开始播放视频了哈哈')
        $(this).parent().find('.mainimg').remove()
        $(this).parents('.classitem').find('.classitem_vidio').trigger('play')
        var vidioTime = $(this).parents('.classitem').find('.classitem_vidio')[0].duration
        $(this).parent().find('.palyer').remove()
      })
      // 问题未解决 最新切换
      $('.questionItems').on('click', '.questionItems_topnav_span',  function() {
        if($(this).hasClass('questionItems_topnav_span_active')) {
          return
        }
        clickchange($(this), '.questionItems_topnav_span', 'questionItems_topnav_span_active')
        testQuestion.status = !testQuestion.status
        testQuestion.status = Number(testQuestion.status)
        possibleUrl = '/admin.php/api/homepage/issue_list'
        $.ajax({
          url: urlhost + possibleUrl,
          type: 'POST',
          data: testQuestion,
          header: {},
          success: function (res) {
            if (res.code == 0) {
              loadingHide()
              var question_serverdata = res
              // console.log(res)
              rendering ($('.consultView_ul'), 4, question_serverdata.data)
              changeInitPage(question_serverdata.list_page, 1)
              currentRender = 1
            } else {
              // 移除加载中样式
              loadingHide()
              return(res.data)
            }
          },
          fail: function () {
            alert('网络有问题')
          }
        })


      })
      // 填报志愿跳转
      $('.volunteering').click(
        function() {
          if(!store.get('uid')) {
            $('.loginview').show()
            return
          }
          window.location.href = './volunteer.html'
        }
      )
      $('.Learning').click(
        function() {
          $('.contentView_li').eq(1).click()
        }
      )
      // 在线咨询跳转
      $('.learnCenterPage').on('click', '.consultOnline', function() { 

        window.location.href = './consultOnline.html'
      })
      // 试题详情跳转
      $('.learnCenterPage').on('click', '.testQuestion', function() {
        if(!store.get('uid')) {
          $('.loginview').show()
          return
        }
        var testid = $(this).attr('id').slice(4)
        window.open('./testItem.html?id=' + testid + '&type=3')
      })
      // 在线提问点击事件
      $('body').on('click', '.zixun_btn', function () {
        var ques = $(this).parent().find('textarea').val()
        if(ques == '') {
          alert('请输入提问内容')
        }else {
          $.ajax({
            url: urlhost + '/admin.php/api/homepage/issue',
            method: 'POST',
            data: {
              uid: store.get('uid'),
              desc: ques
            },
            success: function(res) {
              if(res.code == 0) {
                $('.OnlineQuestion').hide()
                widowAle('提问成功')
              }
            }
          })
        }
      })
      $('.zixuntz').click(
        function () {
          if(!store.get('uid')) {
            $('.loginview').show()
            return
          }
          window.location.href = './index.html?index=6'
        }
      )


      // 轮播图获取
      // 轮播图获取
      $.ajax({
        url: urlhost + '/admin.php/api/homepage/pc_banner',
        method: 'POST',
        data: {
          type: 1
        },
        success: function(res) {
          // <div class="swiper-slide">
          //   <img class="_img" src="./static/images/mainSwipper.png" alt="">
          // </div>
          $('.swiper-wrapper').empty()
          var html = ''
          for(var i=0;i<res.data.length;i++) {
            html += '<div class="swiper-slide">'
              + '<img class="ImgSwipperview_img" src="' + res.data[i].pic + '" alt="">'
            + '</div>'
          }
          $('.swiper-wrapper').html(html)
        }
      })

      // var availableTags = [
      //   "James",
      //   "Kobe",
      //   "Jordan"
      // ];
      // $( "#tag" ).autocomplete({
      //   source: availableTags
      // });
    })
  </script>
</body>
</html>
